
//
//  NSDate+cmp.m
//  小团购
//
//  Created by 樊荣海 on 15/2/6.
//  Copyright (c) 2015年 樊荣海. All rights reserved.
//

#import "NSDate+cmp.h"

@implementation NSDate (cmp)

+ (NSDateComponents *)cmpsFromData:(NSDate *)fromDate toDate:(NSDate *)toDate {
    
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSInteger unitFlags = NSYearCalendarUnit| NSMonthCalendarUnit | NSDayCalendarUnit| NSCalendarUnitHour|NSCalendarUnitMinute;
    NSDateComponents *cmp = [calendar components:unitFlags fromDate:fromDate toDate:toDate options:0];
    
    return cmp;
}


@end
